package analysis;

import beans.AdClickEvent;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author zkq
 * @date 2022/10/6 21:08
 */
//结论 状态和本地变量的区别是 故障处理，一致性，检查点等 其他感觉差不多
public class test {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        DataStreamSource<Integer> stream = env.fromElements(6,6,6,6,6,6);
        stream.map(new MapFunction<Integer, Integer>() {
            int a =0;
            @Override
            public Integer map(Integer value) throws Exception {
                a ++;
                System.out.println(a);
                return value;
            }
        }).print();
        env.execute();
    }
}
